Build
# Create Build
Request
POST /openapi/build?projectKey=<project identifier>
1
Body Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
name | Build name | string | Yes |
project_key | Project identifier | string | Yes |
infrastructure | Infrastructure, kubernetes for kubernetes cluster, vm for host | string | Yes |
build_os | Build operating system | string | Yes |
installs | Dependent software packages | string | Yes |
script_type | Script type, supports shell, batch_file, powershell | string | Yes |
build_script | Build operating system | string | Yes |
repo_info | Code information | []RepoInfo | No |
parameters | Custom variables | []Parameter | No |
services | Bound services | []ServiceWithModule | Yes |
docker_build_step | Image build step | []DockerBuildStep | No |
advanced_settings | Advanced settings | []AdvancedSettings | No |
ServiceWithModule Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
service_module | Service module name | string | Yes |
service_name | Service name | string | Yes |
RepoInfo Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
codehost_name | Code source identifier | string | Yes |
repo_namespace | Repository namespace (organization/user) | string | Yes |
repo_name | Repository name | string | Yes |
branch | Branch information | string | Yes |
Parameter Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
key | Variable key | string | Yes |
type | Variable type, supports string, choice, multi-select | string | Yes |
is_credential | Is sensitive information | bool | No |
description | Variable description | string | No |
default_value | Variable default value | string | Yes |
choice_value | Variable multi-select value list | []string | No |
choice_option | Variable optional value list | []string | No |
Input Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
key | Variable key | string | Yes |
value | Variable value | string | Yes |
DockerBuildStep Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
dockerfile_source | Dockerfile source, local for code repository, template for template library | string | Yes |
build_context_dir | Build context directory | string | Yes |
dockerfile_directory | Dockerfile absolute path | string | Yes |
build_args | Build arguments | string | No |
template_name | Template name | string | No |
enable_buildkit | Enable Buildkit | string | No |
platforms | Buildkit build platform | string | No |
AdvancedSettings Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
cluster_name | Cluster name | string | No |
strategy_name | Scheduling strategy name | string | No |
timeout | Build timeout time | int | No |
resource_spec | Cluster configuration item list | ResourceSpec | No |
use_host_docker_daemon | Use host docker daemon | bool | No |
privileged_mode | Enable privileged mode | bool | No |
cache_setting | Cache configuration | CacheSetting | No |
storages | Storage configuration | StorageSetting | No |
custom_annotations | Custom annotations | []Input | No |
custom_labels | Custom labels | []Input | No |
outputs | Output variables | []string | No |
ResourceSpec Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
cpu_req | CPU request | int | Yes |
cpu_limit | CPU limit | int | Yes |
memory_req | Memory request | int | Yes |
memory_limit | Memory limit | int | Yes |
gpu_limit | GPU limit | string | No |
CacheSetting Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
enabled | Enable cache | bool | Yes |
cache_dir | Cache directory | string | Yes |
StorageSetting Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
enabled | Enable storage | bool | Yes |
storages_properties | Storage property list | []StoragesProperty | Yes |
StoragesProperty Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
access_mode | Access mode, if not set, defaults to ReadWriteMany, supports ReadWriteOnce, ReadOnlyMany, ReadWriteMany, ReadWriteOncePod | string | No |
is_temporary | Is temporary storage | bool | No |
mount_path | Mount path | string | Yes |
provision_type | Storage type, dynamic for dynamic resource, static for existing storage | string | Yes |
pvc | PVC name, used when provision_type is static | string | No |
storage_class | Storage class name, used when provision_type is dynamic | string | No |
storage_size_in_gib | Storage size, used when provision_type is dynamic | int | Yes |
subpath | Storage volume subpath | string | Yes |
Body Parameter Example
{
"build_os": "ubuntu 20.04",
"build_script": "#!/bin/bash\nset -e\necho 'hello from api'\ncd $REPONAME_0\nmake build-$SERVICE",
"docker_build_step": {
"build_args": "--build-arg service=$SERVICE",
"build_context_dir": "$REPONAME_0",
"dockerfile_directory": "$REPONAME_0/Dockerfile",
"dockerfile_source": "local",
"enable_buildkit": true,
"platforms": "linux/amd64",
"template_name": ""
},
"infrastructure": "kubernetes",
"installs": [
{
"name": "go",
"version": "1.20.7"
}
],
"name": "api-test",
"parameters": [
{
"choice_option": [
"a",
"b",
"c"
],
"choice_value": [
"a",
"b"
],
"default_value": "a",
"description": "a multi-select var",
"is_credential": false,
"key": "aa",
"type": "multi-select"
},
{
"default_value": "abc123",
"description": "a string values",
"is_credential": true,
"key": "bb",
"type": "string"
}
],
"project_key": "yaml",
"repo_info": [
{
"branch": "main",
"codehost_name": "gitlab",
"repo_name": "multi-service-demo",
"repo_namespace": "kr-test-org1"
}
],
"script_type": "shell",
"services": [
{
"service_module": "service1",
"service_name": "service1"
},
{
"service_module": "service2",
"service_name": "service2"
}
],
"advanced_settings": {
"cache_setting": {
"cache_dir": "$WORKSPACE",
"enabled": true
},
"cluster_name": "local-20250523164625",
"custom_annotations": [
{
"key": "test-a",
"value": "abc"
}
],
"custom_labels": [
{
"key": "test-a",
"value": "abc"
}
],
"outputs": [
"bb"
],
"privileged_mode": false,
"resource_spec": {
"cpu_limit": 1000,
"cpu_req": 100,
"memory_limit": 2000,
"memory_req": 200
},
"storages": {
"enabled": true,
"storages_properties": [
{
"access_mode": "ReadOnlyMany",
"is_temporary": true,
"mount_path": "/workspace",
"provision_type": "dynamic",
"pvc": "share-storage-cfs-10",
"storage_class": "cfs",
"storage_size_in_gib": 2,
"subpath": "$PROJECT"
}
]
},
"strategy_name": "优先调度",
"timeout": 30,
"use_host_docker_daemon": false
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
Response
{
"message": "success"
}
1
2
3
2
3
# Update Build
Request
PUT /openapi/build?projectKey=<project identifier>
1
Body Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
name | Build name | string | Yes |
project_key | Project identifier | string | Yes |
infrastructure | Infrastructure, kubernetes for kubernetes cluster, vm for host | string | Yes |
build_os | Build operating system | string | Yes |
installs | Dependent software packages | string | Yes |
script_type | Script type, supports shell, batch_file, powershell | string | Yes |
build_script | Build operating system | string | Yes |
repo_info | Code information | []RepoInfo | No |
parameters | Custom variables | []Parameter | No |
services | Bound services | []ServiceWithModule | Yes |
docker_build_step | Image build step | []DockerBuildStep | No |
advanced_settings | Advanced settings | []AdvancedSettings | No |
Body Parameter Example
{
"build_os": "ubuntu 20.04",
"build_script": "#!/bin/bash\nset -e\necho 'hello from api'\ncd $REPONAME_0\nmake build-$SERVICE",
"docker_build_step": {
"build_args": "--build-arg service=$SERVICE",
"build_context_dir": "$REPONAME_0",
"dockerfile_directory": "$REPONAME_0/Dockerfile",
"dockerfile_source": "local",
"enable_buildkit": true,
"platforms": "linux/amd64",
"template_name": ""
},
"infrastructure": "kubernetes",
"installs": [
{
"name": "go",
"version": "1.20.7"
}
],
"name": "api-test",
"parameters": [
{
"choice_option": [
"a",
"b",
"c"
],
"choice_value": [
"a",
"b"
],
"default_value": "a",
"description": "a multi-select var",
"is_credential": false,
"key": "aa",
"type": "multi-select"
},
{
"default_value": "abc123",
"description": "a string values",
"is_credential": true,
"key": "bb",
"type": "string"
}
],
"project_key": "yaml",
"repo_info": [
{
"branch": "main",
"codehost_name": "gitlab",
"repo_name": "multi-service-demo",
"repo_namespace": "kr-test-org1"
}
],
"script_type": "shell",
"services": [
{
"service_module": "service1",
"service_name": "service1"
},
{
"service_module": "service2",
"service_name": "service2"
}
],
"advanced_settings": {
"cache_setting": {
"cache_dir": "$WORKSPACE",
"enabled": true
},
"cluster_name": "local-20250523164625",
"custom_annotations": [
{
"key": "test-a",
"value": "abc"
}
],
"custom_labels": [
{
"key": "test-a",
"value": "abc"
}
],
"outputs": [
"bb"
],
"privileged_mode": false,
"resource_spec": {
"cpu_limit": 1000,
"cpu_req": 100,
"memory_limit": 2000,
"memory_req": 200
},
"storages": {
"enabled": true,
"storages_properties": [
{
"access_mode": "ReadOnlyMany",
"is_temporary": true,
"mount_path": "/workspace",
"provision_type": "dynamic",
"pvc": "share-storage-cfs-10",
"storage_class": "cfs",
"storage_size_in_gib": 2,
"subpath": "$PROJECT"
}
]
},
"strategy_name": "优先调度",
"timeout": 30,
"use_host_docker_daemon": false
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
Response
{
"message": "success"
}
1
2
3
2
3
# Create Build from Template
Request
POST /openapi/build?source=template
1
Body Parameter Description
| Parameter Name | Description | Type | Required |
|---|---|---|---|
name | Build name | string | Yes |
project_key | Project identifier | string | Yes |
template_name | Build template name | string | Yes |
target_services | Service configuration | []TargetService | Yes |
TargetService Parameter Description
| Parameter Name | Description | Type | Required |
|---|---|---|---|
service_module | Service module name | string | Yes |
service_name | Service name | string | Yes |
repo_info | Repository info | []RepoInfo | Yes |
inputs | Variable info | []Input | Yes |
RepoInfo Parameter Description
| Parameter Name | Description | Type | Required |
|---|---|---|---|
codehost_name | Code source identifier | string | Yes |
repo_namespace | Repository namespace (organization/user) | string | Yes |
repo_name | Repository name | string | Yes |
branch | Branch information | string | Yes |
Input Parameter Description
| Parameter Name | Description | Type | Required |
|---|---|---|---|
key | Variable key | string | Yes |
value | Variable value | string | Yes |
Body Parameter Example
{
"name": "demo-build",
"project_key": "demo",
"template_name": "demo-template",
"target_services": [
{
"service_module": "aslan",
"service_name": "zadigx",
"repo_info": [
{
"codehost_name": "github-demo",
"repo_namespace": "kr-test-org",
"repo_name": "zadig",
"branch": "main"
}
],
"inputs": [
{
"key": "name",
"value": "admin"
},
{
"key": "password",
"value": "zadigx"
}
]
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Return
{
"message": "success"
}
1
2
3
2
3
# Update Build from Template
Request
PUT /openapi/build/<build name>/template?projectKey=<project identifier>
1
Body Parameters
| Parameter Name | Description | Type | Required |
|---|---|---|---|
name | Build name | string | Yes |
project_key | Project identifier | string | Yes |
template_name | Build template name | string | Yes |
target_services | Service configuration | []TargetService | Yes |
Body Parameter Example
{
"name": "demo-build",
"project_key": "demo",
"template_name": "demo-template",
"target_services": [
{
"service_module": "aslan",
"service_name": "zadigx",
"repo_info": [
{
"codehost_name": "github-demo",
"repo_namespace": "kr-test-org",
"repo_name": "zadig",
"branch": "main"
}
],
"inputs": [
{
"key": "name",
"value": "admin"
},
{
"key": "password",
"value": "zadigx"
}
]
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Return
{
"message": "success"
}
1
2
3
2
3
# Query Build List
Request
GET /openapi/build?projectKey=<project identifier>&pageNum=<current page number>&pageSize=<current page display count>
1
Query Parameter Description
| Parameter Name | Type | Description | Required | Default Value |
|---|---|---|---|---|
projectKey | string | Project identifier | Yes | None |
pageNum | int | Page parameter-current page number | No | 1 |
pageSize | int | Page parameter-current page display count | No | 20 |
Return Description
| Parameter Name | Type | Description |
|---|---|---|
total | int | Build module total number |
builds | []Build | Build module list |
Build Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
name | string | Build name |
project_key | string | Project identifier |
source | string | Build method, there are two: zadig, jenkins |
update_by | string | Updater |
update_time | int | Update time |
target_services | []TargetService | Service component list |
TargetService Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
service_name | string | Service name |
service_module | string | Service component name |
Normal Return
Details
{
"total": 2,
"builds": [
{
"name": "s-build",
"project_key": "lilian-test",
"source": "zadig",
"update_by": "admin",
"update_time": 1686192895,
"target_services": [
{
"service_name": "service1",
"service_module": "service1"
},
{
"service_name": "service2",
"service_module": "service2"
}
]
},
{
"name": "openapi-build",
"project_key": "lilian-test",
"source": "zadig",
"update_by": "admin",
"update_time": 1688040721,
"target_services": [
{
"service_name": "service1",
"service_module": "service1"
}
]
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Get Build Details
Request
GET /openapi/build/:buildName/detail?projectKey=<project identifier>
1
Query Parameter Description
| Parameter Name | Type | Description | Required | Default Value |
|---|---|---|---|---|
projectKey | string | Project identifier | Yes | None |
serviceName | string | Service name | Yes | None |
serviceModule | string | Service component name | Yes | None |
Path Parameter Description
| Parameter Name | Type | Description | Required | Default Value |
|---|---|---|---|---|
buildName | string | Build name | Yes | None |
Return Description
Details
{
"project_key": "lilian-test", // Project identifier
"name": "openapi-build", // Build name
"source": "", // Build method, there are two: zadig,jenkins
"target_services": [ // Service list
{
"service_name": "service1", // Service name
"service_module": "service1" // Service component name
}
],
"template_name": "test", // Template name
"update_by": "admin", // Updater name
"update_time": 1690215924, // Update time, second level timestamp
"repos": [ // Repository information
{
"source": "gitee", // There are several types: github, gitlab, gerrit, codehub, gitee, gitee-enterprise, other
"repo_owner": "liyue326", // Organization name/user name
"repo_name": "hello", // Repository name
"remote_name": "origin", // Remote name
"branch": "master", // Branch name
"address":"https://gitlab.com", // Repository source
"checkout_path":"", // Clone directory name
"submodules":false, // Submodule
},
],
"build_env": { // Build environment
"basic_image_id": "63047770931401b9baa6e396", // Operating system image ID
"basic_image_label": "ubuntu 20.04", // Operating system image name
"installs": [ // Build dependent software package list
{
"name": "go",
"version": "1.13"
}
]
},
"advanced_settings": { // Advanced configuration
"cluster_name": "local-20220823144517", // Cluster name
"timeout": 60, // Build timeout time
"resource_spec": { // Cluster configuration item list
"cpu_limit": 1000,
"memory_limit": 512,
"gpu_limit": ""
},
"use_host_docker_daemon": false, // Whether to use host docker daemon
"cache_setting": { // Cache configuration
"enabled": false, // Whether to use custom workspace
"cache_dir": "" // Cache path under custom workspace
}
},
"build_script": "#!/bin/bash\nset -e", // Build script
"parameters": [ // Custom variable list
{
"key": "a",
"value": "1",
"type": "string",
"is_credential": false
}
],
"outputs": [ // Output variable list
{
"name": "IMAGE",
"description": ""
},
{
"name": "PKG_FILE",
"description": ""
},
{
"name": "xx",
"description": ""
}
],
"post_build": { // Add step
"docker_build": { // Image build configuration
"work_dir": "temp", // Build context directory
"docker_file": "temp", // Absolute path of Dockerfile
"build_args": "", // Build parameter
"source": "local", // Dockerfile source
"template_name": "" // template name (if dockerfile source is template)
},
"object_storage_upload": { // File storage
"enabled": true, // Whether to use workspace cache
"object_storage_id": "63422e0690069fe35f4e62bb", // sidebarMenu.objectStorage
"upload_detail": [ // Upload file configuration
{
"file_path": "test",
"abs_file_path": "",
"dest_path": "temp"
}
]
},
"file_archive": { // Binary package storage
"file_location": "temp" // Binary package storage path
},
"scripts": "#!/bin/bash\nset -e" // Shell script
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Delete Build
Request
DELETE /openapi/build?name=<build name>&projectKey=<project identifier>
1
Query Parameter Description
| Parameter Name | Description | Type | Required |
|---|---|---|---|
name | Build name | string | Yes |
projectKey | Project identifier | string | Yes |
Return Description
{
"message": "success"
}
1
2
3
2
3


